package com.syp.auth.export.common;

import java.util.HashSet;
import java.util.Set;

import com.syp.auth.domain.enums.ResourceIsLogAccessEnum;
import com.syp.auth.domain.vo.ResourceVo;
import com.syp.auth.export.resource.AuthorizeResourceI;

public class AuthorizeExtractor {

	public GeneralUserVo guser;

	public AuthorizeExtractor(GeneralUserVo guser) {
		this.guser = guser;
	}

	public AuthorizeExtractor(AuthorizeResourceI authorizeResource, String sid) {
		this.guser = authorizeResource.cuser(sid);
	}

	public Set<String> logAccessUri() {
		Set<String> us = new HashSet<>();
		for (ResourceVo r : guser.getPermitResList()) {
			if (r.getIsLogAccess() != null && r.getIsLogAccess() == ResourceIsLogAccessEnum.TRUE.getCode()) {
				us.add(r.getResUrl());
			}
		}
		return us;
	}

}
